package com.example.goodsass.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.goodsass.service.GoodsassService;
import com.example.goodsass.domain.Goodsass;
import com.example.goodsass.mapper.GoodsassMapper;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author 31673
* @description 针对表【goodsass】的数据库操作Service实现
* @createDate 2025-04-05 19:54:13
*/
@Service
public class GoodsassServiceImpl extends ServiceImpl<GoodsassMapper, Goodsass>
    implements GoodsassService {
@Resource GoodsassMapper goodsassMapper;
    @Override
    public List<Goodsass> AssSelByNo() {
        List<Goodsass> AssList=goodsassMapper.selectList(null);
        return goodsassMapper.selectList(null);
    }

    @Override
    public String AssIns(int Goods_No, int Goods_Num, String GoodsAss_Flg) {
        Goodsass goodsass = new Goodsass();
        goodsass.setGoodsNo(Goods_No);
        goodsass.setGoodsNum(Goods_Num);
        goodsass.setGoodsassFlg(GoodsAss_Flg);
        goodsassMapper.insert(goodsass);
        return  "已插入在库数据，编号："+Goods_No;
    }

    @Override
    public String AssDelByNo(int id) {
        goodsassMapper.deleteById(id);
        return "删除成功，在库编号："+id;
    }

    @Override
    public String AssUpdByNo(Goodsass goodsass) {
        if (goodsass.getGoodsNo()==null){
            return "请输入商品编号";
        }
        goodsassMapper.updateById(goodsass);
        return "更新成功，在库商品编码号："+goodsass.getGoodsNo();
    }
}




